package com.fin.zw.intelligentbot.controller.api;


import com.fin.zw.intelligentbot.annotation.CurrentUser;
import com.fin.zw.intelligentbot.model.ResulteWraper;
import com.fin.zw.intelligentbot.model.response.StrategyInfoResponse;
import com.fin.zw.intelligentbot.model.session.SessionModel;
import com.fin.zw.intelligentbot.service.StrategyInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

@RestController
@RequestMapping("/api/strategy")
@Api(value = "策略信息", description = "策略信息")
public class StrategyController {

    @Autowired
    private StrategyInfoService strategyInfoService;

    @GetMapping("/fetch")
    @ApiOperation(value = "查询对应的策略信息", notes = "查询对应的策略信息")
    public ResponseEntity<ResulteWraper> fetch(@ApiIgnore @CurrentUser SessionModel sessionModel) {
        ResulteWraper result = new ResulteWraper();
        List<StrategyInfoResponse> list = strategyInfoService.getStrategyInfoResponseList(sessionModel);
        result.setData(list);
        return ResponseEntity.ok().body(result);
    }
}
